# Maintainer: Jordan Irwin <antumdeluge@gmail.com>

_realname=wxsvg
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgbase="mingw-w64-${_realname}"
pkgver=1.5.22
pkgrel=1
pkgdesc="A C++ library to create, manipulate and render SVG files (mingw-w64)"
arch=("any")
url="http://wxsvg.sourceforge.net/"
license=("custom:wxWindows")
depends=("${MINGW_PACKAGE_PREFIX}-wxWidgets"
         "${MINGW_PACKAGE_PREFIX}-cairo"
         "${MINGW_PACKAGE_PREFIX}-pango"
         "${MINGW_PACKAGE_PREFIX}-expat"
         "${MINGW_PACKAGE_PREFIX}-libexif"
         "${MINGW_PACKAGE_PREFIX}-ffmpeg")
makedepends=("bsdtar"
             "${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config")
source=("https://downloads.sourceforge.net/project/wxsvg/wxsvg/${pkgver}/wxsvg-${pkgver}.tar.bz2")
sha256sums=('0de168cd9f0ccd309b8640c1b6e89f2a906983bc12efe75b0c5cd30f1eaff529')
extractdir="${_realname}-${pkgver}"
builddir="build-${CARCH}"

build() {
  [[ -d "${srcdir}/${builddir}" ]] && rm -rf "${srcdir}/${builddir}"
  mkdir -p "${srcdir}/${builddir}" && cd "${srcdir}/${builddir}"

  ../${extractdir}/configure \
      --prefix=${MINGW_PREFIX} \
      --host=${MINGW_CHOST} \
      --target=${MINGW_CHOST} \
      --build=${MINGW_CHOST} \
      --enable-shared \
      --enable-static
  make
}

check() {
  cd "${srcdir}/${builddir}"
  make -k check
}

package() {
  cd "${srcdir}/${builddir}"
  make install DESTDIR="${pkgdir}"

  # license
  install -Dm644 "${srcdir}/${extractdir}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
